<?php
$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura/MDHoteles";
$ruta2=$_SERVER['DOCUMENT_ROOT']."/viventura";




include_once("$ruta/conf/CConfig.php");

require_once "$ruta2/files/PHPWord.php";


$codetour=$_POST['codtour'];
$codehotel=$_POST['codhotel'];

//$query="select * from tour_as where tour_idTour=$codetour	and hoteles_idHot=$codehotel";

$q="select idAs,bloq,conf,fech_ini,fech_fin,simpHot,dobHot,matHot,idHot,NamHot from hoteles 
INNER JOIN tour_as on hoteles.idHot = tour_as.hoteles_idHot where tour_idTour=$codetour and hoteles_idHot=$codehotel";
$result=CModelo::getInstance()->getData($q);        

//$qur="select idTour,NamTypTour,";

$PHPWord = new PHPWord();

$document = $PHPWord->loadTemplate("$ruta2/files/templates/bloqtemp.docx");
$document->setValue('Value0','Destino Sur S.A.C');
$namehotel=$result[0]['NamHot'];
$document->setValue('Value1', "$namehotel");
$document->setValue('Value2', 'Bloqueos');
//$document->setValue('valor23','edson luque');
$document->setValue('Value3', 'Venus');
$document->setValue('Value4', 'Earth');

$document->setValue('Value7', 'Saturn');
$document->setValue('Value8', 'Uranus');
$document->setValue('Value9', 'Neptun');
$fechi=$result[0]['fech_ini'];$fecho=$result[0]['fech_fin'];
$document->setValue('NewVal1', "$fechi");

$document->setValue('NewVal2', "$fecho");
//$document->addText('edson luque');
$simple=$result[0]['simpHot'];
$document->setValue('simp',"$simple");
$doble=$result[0]['dobHot'];
$document->setValue('dob',"$doble");
$matr=$result[0]['matHot'];
$document->setValue('matr',"$matr");


$nombredoc="$namehotel".".docx";
$document->save("$ruta/"."$namehotel".".docx");

?>

//<?php echo $nombredoc;?>


